import { useAxios } from '@/hooks/web/useAxios'

const request = useAxios()

import { useCache } from '@/hooks/web/useCache'
const { wsCache } = useCache()

// 字典查询
export const sysDictApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDict',
      data: data
    }
  })
}

// 字典联动查询
export const sysDictRelsApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictRels',
      data: data
    }
  })
}

export const sysDictTypeListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictTypeList',
      data: data
    }
  })
}
export const sysDictTypeAddApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictTypeAdd',
      data: data
    }
  })
}
export const sysDictTypeEditApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictTypeEdit',
      data: data
    }
  })
}
export const sysDictTypeSeeApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictTypeSee',
      data: data
    }
  })
}
export const sysDictTypeDelApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictTypeDel',
      data: data
    }
  })
}

export const sysDictDataListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictDataList',
      data: data
    }
  })
}

export const sysDictDataAddApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictDataAdd',
      data: data
    }
  })
}

export const sysDictDataEditApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictDataEdit',
      data: data
    }
  })
}

export const sysDictDataDelApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictDataDel',
      data: data
    }
  })
}

// 字典联动
export const sysDictRelsListApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictRelsList',
      data: data
    }
  })
}

export const sysDictRelsAddApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictRelsAdd',
      data: data
    }
  })
}

export const sysDictRelsEditApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictRelsEdit',
      data: data
    }
  })
}

export const sysDictRelsSeeApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictRelsSee',
      data: data
    }
  })
}

export const sysDictRelsDelApi = (data: any) => {
  const token: string = wsCache.get('token')
  return request.post({
    url: 'index.php/api/common',
    headers: { token: token },
    data: {
      code: 'sysDictRelsDel',
      data: data
    }
  })
}
